#!/usr/bin/env python

import wx

class Zoom(wx.Slider):
    '''Zoom class
    
    @author Julot <andy.julot@gmail.com>
    @since Thursday, April 05, 2012. 12:21 PM'''
    
    def __init__(self, parent):
        super(Zoom, self).__init__(parent, value=10, minValue=1, maxValue=19,
                                   size=(100, -1))
        
        self.Bind(wx.EVT_SCROLL, self._setToolTip)
        self.Bind(wx.EVT_SCROLL_CHANGED, self._setToolTip)
    
    def _setToolTip(self, event):
        zoom = event.Int * 10
        toolTip = wx.ToolTip('%d%%' % zoom)
        self.ToolTip = toolTip
        event.Skip()
    
    def GetValue(self):
        return super(Zoom, self).GetValue()
    
    def SetValue(self, value):
        super(Zoom, self).SetValue(value)
        zoom = value * 10
        toolTip = wx.ToolTip('%d%%' % zoom)
        self.ToolTip = toolTip
    
    Value = property(GetValue, SetValue)